﻿//-----------------------------------------------------------------------
// <copyright file="Assembly.cs">
//     Copyright (c) Nicole Calinoiu. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.IO;
using System.Xml;
using Microsoft.FxCop.Sdk;

namespace Bordecal.FxCop.Sdk.Testing
{
	/// <summary>
	/// Represents a .NET assembly screened by FxCop.
	/// </summary>
	internal sealed class Assembly : Target
	{
		internal Assembly(XmlElement element)
			: base(null, element)
		{
			// Trim the path part of the assembly name:
			if (!string.IsNullOrEmpty(this.Name))
			{
				this.Name = this.Name.Substring(this.Name.LastIndexOfAny(
					new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }) + 1);
			}
		}

		internal Assembly(AssemblyNode assembly)
			: base(null, assembly.ModuleName)
		{
		}
	}
}